package club.xinghe.servlet.admin;

import club.xinghe.biz.StudentBiz;
import club.xinghe.entity.Student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/GetStudentByKeyServlet")
public class GetStudentByKeyServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int yid = Integer.parseInt ( request.getParameter ( "yid" ) );
        int zid = Integer.parseInt ( request.getParameter ( "zid" ) );
        int cid = Integer.parseInt ( request.getParameter ( "cid" ) );
        int gid = Integer.parseInt ( request.getParameter ( "gid" ) );

       StudentBiz studentBiz=new StudentBiz ();
        List<Student>studentList= studentBiz.getStudentBykey ( yid,zid,cid,gid );

        if (studentList!=null){
            request.setAttribute ( "studentList",studentList  );
            request.getRequestDispatcher ("/admin/seachStudent.jsp").forward ( request,response );
        }

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   doPost ( request,response );
    }
}
